package com.ruoyi.inventory.service.impl;

import java.time.LocalDateTime;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.inventory.mapper.StorehouseMapper;
import com.ruoyi.inventory.domain.Storehouse;
import com.ruoyi.inventory.service.IStorehouseService;

/**
 * 仓库Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-10-28
 */
@Service
public class StorehouseServiceImpl implements IStorehouseService 
{
    @Autowired
    private StorehouseMapper storehouseMapper;

    /**
     * 查询仓库
     * 
     * @param id 仓库主键
     * @return 仓库
     */
    @Override
    public Storehouse selectStorehouseById(Long id)
    {
        return storehouseMapper.selectStorehouseById(id);
    }

    /**
     * 查询仓库列表
     * 
     * @param storehouse 仓库
     * @return 仓库
     */
    @Override
    public List<Storehouse> selectStorehouseList(Storehouse storehouse)
    {
        return storehouseMapper.selectStorehouseList(storehouse);
    }

    /**
     * 新增仓库
     * 
     * @param storehouse 仓库
     * @return 结果
     */
    @Override
    public int insertStorehouse(Storehouse storehouse)
    {
        storehouse.setCreatedTime(LocalDateTime.now());
        return storehouseMapper.insertStorehouse(storehouse);
    }

    /**
     * 修改仓库
     * 
     * @param storehouse 仓库
     * @return 结果
     */
    @Override
    public int updateStorehouse(Storehouse storehouse)
    {
        storehouse.setUpdatedTime(LocalDateTime.now());
        return storehouseMapper.updateStorehouse(storehouse);
    }

    /**
     * 批量删除仓库
     * 
     * @param ids 需要删除的仓库主键
     * @return 结果
     */
    @Override
    public int deleteStorehouseByIds(Long[] ids)
    {
        return storehouseMapper.deleteStorehouseByIds(ids);
    }

    /**
     * 删除仓库信息
     * 
     * @param id 仓库主键
     * @return 结果
     */
    @Override
    public int deleteStorehouseById(Long id)
    {
        return storehouseMapper.deleteStorehouseById(id);
    }
}
